package com.uzai.console.enums;

import com.alibaba.excel.util.StringUtils;

/**
 * 支付宝账单状态
 * @Auther: liuqi
 * @Date: 2021/8/19 11:22
 * @Description:
 */
public enum AlipayMchBatchStatusEnum {
    INIT("INIT","批次已接收"),
    WAIT_PAY("WAIT_PAY","等待支付"),
    DEALING("DEALING","批次处理中"),
    SUCCESS("SUCCESS","批次处理全部成功"),
    PART_SUCCESS ("PART_SUCCESS","批次处理部分成功"),
    FAIL("FAIL","全部处理失败"),
    DISUSE("DISUSE","批次单据废弃"),
    INVALID("INVALID","批次单据中明细全部无效"),
    ;

    private String key;
    private String desc;

    AlipayMchBatchStatusEnum(String key, String desc) {
        this.key = key;
        this.desc = desc;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static AlipayMchBatchStatusEnum getByKey(String key) {
        if (StringUtils.isBlank(key)) {
            return null;
        }
        for (AlipayMchBatchStatusEnum type: AlipayMchBatchStatusEnum.values()) {
            if (type.getKey().equals(key)) {
                return type;
            }
        }
        return null;
    }
}
